package com.fintech.third.edczxutil.style;

import java.util.ArrayList;
import java.util.List;

public class StyleContext {

	private static List<Style> styles=new ArrayList<>();
	
	public static Style getStyle(String id){
		for (Style style : styles) {
			if(style.getId().equals(id)){
				return style;
			}
		}
		throw new RuntimeException("style is not find");
	}
	
	public static void addStyle(Style style){
		styles.add(style);
	}
	
	public static StyleElement getElement(Style style,String title){
		for (StyleElement eleament : style.getElements()) {
			if(eleament.getTitle().equals(title)){
				return eleament;
			}
		}
		return null;
	}
}
